<template>
	<view>
		<u-navbar :is-back="false" title="　" :border-bottom="false">
			<!-- <view class="u-flex u-row-right" style="width: 100%;">
				<view class="camera u-flex u-row-center"><u-icon name="camera-fill" color="#000000" size="48"></u-icon></view>
			</view> -->
		</u-navbar>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<view class="u-m-r-20">
				<u-avatar :src="info.avatar" size="140"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20">{{ info.tel }}</view>
				<view class="u-font-14 u-tips-color">我的金币：{{ info.coin }}</view>
			</view>
			<view class="u-m-l-10 u-p-10">
				<u-icon name="scan" color="#969799" size="28"></u-icon>
			</view>
			<view class="u-m-l-10 u-p-10">
				<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
			</view>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="获取金币" @tap="goPage(`/pages/mine/getcoin`)"></u-cell-item>
				<!-- <u-cell-item icon="star" title="获取金币"></u-cell-item> -->
				<!-- <u-cell-item icon="photo" title="提现"></u-cell-item> -->
				<u-cell-item icon="coupon" title="提现"></u-cell-item>
				<u-cell-item icon="heart" title="发帖赚金币" @tap="goPage(`/pages/info/new`)"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="设置"></u-cell-item>
			</u-cell-group>
			<!-- <u-cell-group>
				<u-cell-item icon="person-delete-fill" title="退出登录" @tap="exitLogin"></u-cell-item>
			</u-cell-group> -->
		</view>
	</view>
</template>

<script>
	import {
		http
	} from '@/lib/js/request';
	import {
		goPage
	} from '@/lib/js/utils';
	export default {
		data() {
			return {
				pic: '/static/bak.jpg',
				info: {}
			};
		},
		onLoad() {
			this.getInfo();
		},
		methods: {
			exitLogin() {
				uni.setStorageSync('token', '')
				goPage(`/pages/index/index`)
			},
			goPage,
			async getInfo() {
				const res = await http('/user/info');
				this.info = res.data;
				uni.setStorageSync('user', this.info);
			}
		}
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #ededed;
	}

	.camera {
		width: 54px;
		height: 44px;

		&:active {
			background-color: #ededed;
		}
	}

	.user-box {
		background-color: #fff;
	}
</style>
